public bool SaveTrackingNewBranch(TrackingNewBranchViewModel _data) { DateTime d = DateTime.Now; TrackingBranch mapperTrackingBranch = new TrackingBranch(); int Idcampaign = _trackingDao.GetCampaignIdByDescripcion(_data.campaign); int idpollster = _trackingDao.GetPollsterIdByIdDevice(_data.IdDevice); DateTime?_StartDate = null; DateTime?_EndDate = null; if (_data.Start != null) { _StartDate = DateTime.ParseExact(_data.Start, "dd/MM/yy HH:mm", null); } if (_data.End != null) { _EndDate = DateTime.ParseExact(_data.End, "dd/MM/yy HH:mm", null); } mapperTrackingBranch.GeoLength = _data.GeoLength; mapperTrackingBranch.Geolatitude = _data.Geolatitude; mapperTrackingBranch.datetime_tracking = d; mapperTrackingBranch.CodeBranch = _data.CodeBranch; mapperTrackingBranch.NameBranch = _data.NameBranch; mapperTrackingBranch.StreetBranch = _data.StreetBranch; mapperTrackingBranch.StatusBranch = _data.StatusBranch; mapperTrackingBranch.RouteBranch = _data.RouteBranch; mapperTrackingBranch.IdPollster = idpollster; mapperTrackingBranch.Idcampaign = Idcampaign; mapperTrackingBranch.timeTask = _data.timetaks; mapperTrackingBranch.ModificationDate = d; mapperTrackingBranch.Start = _StartDate; mapperTrackingBranch.End = _EndDate; mapperTrackingBranch.AggregateUri = _data.AggregateUri; var Status = _trackingDao.SaveTrackingNewBranch(mapperTrackingBranch); return(Status); }
public async Task <IActionResult> SaveNewBranchTracking([FromBody] TrackingNewBranchViewModel _request) { try { reply.messege = "Could not save the information"; reply.status = "Fail"; if (_TrackingBusiness.SaveTrackingNewBranch(_request)) { reply.messege = "Success Save Data"; reply.status = "Ok"; } return(Ok(reply));; } catch (Exception e) { reply.error = e.Message; reply.status = "Error"; return(Ok(reply)); } }