public async Task<JsonResult> AddSample(int id, DeviceDetailsViewModel device) { FARDeviceDetailsDto add = new FARDeviceDetailsDto { MasterId = id, ServiceId = device.ServiceId, WaferNo = device.WaferNo, SerialNo = device.SerialNo, LotNo = device.LotNo, MfgPartNo = device.MfgPartNo, TechnologyId = device.TechnologyId, PackageTypeId = device.PackageTypeId, AssemblySiteId = device.AssembliesTypeId, FabSiteId = device.FabSiteId, DateCode = device.DateCode, Quantity = device.Quantity, Stage = device.StageId == 1 ? true : false, LastUpdatedBy = this.CurrentName, }; var result = await DeviceDetailsRepository.AddDeviceAsync(add); if (result != null) { FARMasterDto master = MasterRepository.Single(id); if (device.ServiceId == (int)ServiceType.FULL_FA)//Full Service await AddProcess(result.Id, master.Product, true); Response.StatusCode = (int)HttpStatusCode.OK; return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { code = "SV01" } }; } else { Response.StatusCode = (int)HttpStatusCode.BadRequest; return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { code = "SV02" } }; } }
public async Task<JsonResult> EditSample(int id, DeviceDetailsViewModel deviceDetail) { var device = await DeviceDetailsRepository.SingleAsync(id); if (device != null) { device.PackageTypeId = deviceDetail.PackageTypeId; device.AssemblySiteId = deviceDetail.AssembliesTypeId; device.FabSiteId = deviceDetail.FabSiteId; device.SerialNo = deviceDetail.SerialNo; device.WaferNo = deviceDetail.WaferNo; device.MfgPartNo = deviceDetail.MfgPartNo; device.Quantity = deviceDetail.Quantity; device.Stage = deviceDetail.StageId == 1 ? true : false; device.TechnologyId = deviceDetail.TechnologyId; device.DateCode = deviceDetail.DateCode; device.LastUpdatedBy = this.CurrentName; device.ServiceId = deviceDetail.ServiceId; var result = await DeviceDetailsRepository.UpdateAsync(device); if (result == Model.SaveResult.SUCCESS) { Response.StatusCode = (int)HttpStatusCode.OK; return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { code = deviceDetail.MasterId } }; } } Response.StatusCode = (int)HttpStatusCode.BadRequest; return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { code = deviceDetail.MasterId } }; //return View(bind); }
/// <summary> /// Binds the device detail. /// </summary> /// <returns></returns> private async Task<DeviceDetailsViewModel> BindDeviceDetail() { var pkgType = await PackageTypesRepository.GetAllAsync(); var assSite = await AssembliesSiteRepository.GetAllAsync(); var fabSite = await FabSiteRepository.GetAllAsync(); var services = await ServiceRepository.GetAllAsync(); var technogoly = await TechnogolyRepository.GetAllAsync(); DeviceDetailsViewModel bind = new DeviceDetailsViewModel { PackageTypes = pkgType, AssembliesTypes = assSite, FabSites = fabSite, Services = services, Technogolies = technogoly, }; return bind; }