public IHttpActionResult UpdateData([FromBody] Biodata req)
 {
     try
     {
         if (req != null)
         {
             using (var dc = new CRUDDataContext())
             {
                 var data = dc.Biodatas.FirstOrDefault(o => o.Username == req.Username);
                 {
                     data.Username  = req.Username;
                     data.Password  = req.Password;
                     data.Firstname = req.Firstname;
                     data.Lastname  = req.Lastname;
                     dc.SubmitChanges();
                     return(Ok(data));
                 };
             }
         }
         else
         {
             return(Unauthorized());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
        public IHttpActionResult Create([FromBody] Biodata req)
        {
            var result = new List <SelectResult>();

            using (var dc = new CRUDDataContext())
            {
                var data = new Biodata()
                {
                    Username  = req.Username,
                    Password  = req.Password,
                    Firstname = req.Firstname,
                    Lastname  = req.Lastname
                };

                dc.Biodatas.InsertOnSubmit(data);
                dc.SubmitChanges();
            }
            return(Ok(result));
        }
 public IHttpActionResult DeleteData(string Username)
 {
     try
     {
         if (Username != null)
         {
             using (var dc = new CRUDDataContext())
             {
                 var data = dc.Biodatas.FirstOrDefault(o => o.Username == Username);
                 dc.Biodatas.DeleteOnSubmit(data);
                 dc.SubmitChanges();
                 return(Ok(data));
             }
         }
         else
         {
             return(Unauthorized());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }