public IHttpActionResult CheckDuplicateResident([FromBody] VCMS_CreateResidentModel CreateResidentModel) { int returnCode = 0; using (var ctx = new GeneralEntity2()) { returnCode = Int32.Parse(ctx.prc_VCMS_check_resident(CreateResidentModel.first_name, CreateResidentModel.last_name, CreateResidentModel.email_address).First().ToString()); } return(Ok(returnCode)); }
public IHttpActionResult CreateResident([FromBody] VCMS_CreateResidentModel CreateResidentModel) { using (var ctx = new GeneralEntity2()) { int payment_balance = Int32.Parse(CreateResidentModel.monthly_collection); if (CreateResidentModel.has_payment == 1) { payment_balance = Int32.Parse(CreateResidentModel.monthly_collection) - Int32.Parse(CreateResidentModel.payment_amount); } ctx.prc_VCMS_create_resident(CreateResidentModel.first_name, CreateResidentModel.middle_name, CreateResidentModel.last_name, CreateResidentModel.email_address, CreateResidentModel.contact_number, CreateResidentModel.monthly_collection, DateTime.Parse(CreateResidentModel.start_date_of_collection), CreateResidentModel.has_payment, CreateResidentModel.logged_user, CreateResidentModel.payment_amount, payment_balance.ToString()); } return(Ok(200)); }