Help with MVC controller code [Resolved]

Posted by Rasagna under ASP.NET MVC on 3/7/2016 | Points: 10 | Views : 267 | Status : [Member] | Replies : 2
I have method to create group.how can I write controller code for this.
 public IServiceResponse<Guid> CreateGroup(GroupModel group)
{
var serviceResponse = CreateGroup(new Domain.Models.Group
{
Name = group.GroupName,
});

return serviceResponse;
}





Responses

Posted by: Rajnilari2015 on: 3/7/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
Try this

public class TestController : Controller
{
public ActionResult Index()
{
var groups = CreateGroup(new GroupModel { GroupName = "Group1"});
ViewData["MyGroupData"] = groups; // Send this list to the view
return View(groups.ToList());
}
}


--
Thanks & Regards,
RNA Team

Rasagna, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rasagna on: 3/9/2016 [Member] Starter | Points: 25

Up
0
Down
@Rajnilari2015,thanks for reply but I have to enter groupname manually using text box control which i have

Rasagna, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response