public IHttpActionResult Get(System.Guid id) { mstRekanan rekTemp = new mstRekanan(); mstRekananForm RekananSingle = new mstRekananForm(); if (id != System.Guid.Empty) { rekTemp = _repository.Get(id); //RekananSingle RekananSingle.InjectFrom(rekTemp); } //re-populate MstRegion var myRegionColls = _repRegion.GetActive(); RekananSingle.TypeOfRegionColls = myRegionColls; //re-populate MstTypeOfRekanan var myTypeOfRekananColls = _repTypeOfRekanan.GetActive(); RekananSingle.TypeOfRekananColls = myTypeOfRekananColls; //re-populate MstTypeOfBadan var myTypeOfBadanColls = _repTypeOfBadanUsaha.GetActive(); RekananSingle.TypeOfBadanUsahaColls = myTypeOfBadanColls; //re-populate MstWilayah var myWilayahColls = _repWilayah.GetActive(); RekananSingle.WilayahColls = myWilayahColls; RekananSingle.ClassAB = new List <SimpleRef>() { new SimpleRef { RefId = 1, RefDescription = "A" }, new SimpleRef { RefId = 2, RefDescription = "B" } }; RekananSingle.ClassABC = new List <SimpleRef>() { new SimpleRef { RefId = 1, RefDescription = "A" }, new SimpleRef { RefId = 2, RefDescription = "B" }, new SimpleRef { RefId = 3, RefDescription = "C" } }; return(Ok(RekananSingle)); }
private mstRekananForm PopulatePhoneFax(mstRekananForm myDataForm) { mstRekananForm myDataReturn = new mstRekananForm(); myDataReturn.InjectFrom(myDataForm); if (!string.IsNullOrEmpty(myDataReturn.Phone1) && myDataReturn.Phone1.Contains("-")) { var arrReturn = myDataReturn.Phone1.Split('-'); if (arrReturn.Length == 2) { myDataReturn.Phone1_1 = arrReturn[0]; myDataReturn.Phone1_2 = arrReturn[1]; } else if (arrReturn.Length == 1) { myDataReturn.Phone1_1 = arrReturn[0]; } } if (!string.IsNullOrEmpty(myDataReturn.Phone2) && myDataReturn.Phone2.Contains("-")) { var arrReturn = myDataReturn.Phone2.Split('-'); if (arrReturn.Length == 2) { myDataReturn.Phone2_1 = arrReturn[0]; myDataReturn.Phone2_2 = arrReturn[1]; } else if (arrReturn.Length == 1) { myDataReturn.Phone2_1 = arrReturn[0]; } } if (!string.IsNullOrEmpty(myDataReturn.Phone3) && myDataReturn.Phone3.Contains("-")) { var arrReturn = myDataReturn.Phone3.Split('-'); if (arrReturn.Length == 2) { myDataReturn.Phone3_1 = arrReturn[0]; myDataReturn.Phone3_2 = arrReturn[1]; } else if (arrReturn.Length == 1) { myDataReturn.Phone3_1 = arrReturn[0]; } } if (!string.IsNullOrEmpty(myDataReturn.Fax1) && myDataReturn.Fax1.Contains("-")) { var arrReturn = myDataReturn.Fax1.Split('-'); if (arrReturn.Length == 2) { myDataReturn.Fax1_1 = arrReturn[0]; myDataReturn.Fax1_2 = arrReturn[1]; } else if (arrReturn.Length == 1) { myDataReturn.Fax1_1 = arrReturn[0]; } } if (!string.IsNullOrEmpty(myDataReturn.Fax2) && myDataReturn.Fax2.Contains("-")) { var arrReturn = myDataReturn.Fax2.Split('-'); if (arrReturn.Length == 2) { myDataReturn.Fax2_1 = arrReturn[0]; myDataReturn.Fax2_2 = arrReturn[1]; } else if (arrReturn.Length == 1) { myDataReturn.Fax2_1 = arrReturn[0]; } } return(myDataReturn); }