Guest User

Guest User

  • Tech Writer
  • 611
  • 128k

Multiple value store in database.

Jul 2 2020 1:34 AM
How to store input multiple value (Like a user multiple injuries) same time in web api.
public InjuerisResult SavePhysicalInjueris([FromBody]InjerisDetail obj_parameter)


{
InjuerisResult obj_result = new InjuerisResult();
try
{
if (obj_parameter == null)
{
//return BadRequest("Owner object is null");
obj_result.Response = 2;
obj_result.ErrorMessage = " object is null";
}
else
{
TblInjurie ****** = new TblInjurie();
obj_tblInjurie.Date = DateTime.ParseExact(obj_parameter.Date, "d/M/yyyy", CultureInfo.InvariantCulture);
obj_tblInjurie.Description = obj_parameter.Description;
obj_tblInjurie.UserInjuriesTypeId = obj_parameter.UserInjuriesTypeId;
obj_tblInjurie.UserId = obj_parameter.UserId;
obj_tblInjurie.IsActive = true;
_context.Add(obj_tblInjurie);
_context.SaveChanges();
}
 
its me code save single ijuries data .But iwant to save multiple injuries detail same time.Please provide solution 

Answers (5)